Integer and memory overflow issues.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 28 Aug 2011 23:52:34 +0000 (16:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 28 Aug 2011 23:52:34 +0000 (16:52 -0700)
commitcea09c26084cd5f491b2da87ddd6d63f5412cc4c
tree6468a67d8a9d972ab1548cf59690c7d299a360c3
parent152bc19db6041207658442ebf1c225b7d14ae356
Integer and memory overflow issues.

* emacsclient.c (xmalloc): Accept size_t, not unsigned int, to
avoid potential buffer overflow issues on typical 64-bit hosts.
Return void *, not long *.
(get_current_dir_name): Report a failure, instead of looping
forever, if buffer size calculation overflows.  Treat malloc
failures like realloc failures, as that has better behavior and is
more consistent.  Do not check whether xmalloc returns NULL, as
that's not possible.
(message): Do not arbitrarily truncate message to 2048 bytes when
sending it to stderr; use vfprintf instead.
(get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket): Do not alloca
arbitrarily-large buffers; that's not safe.
(get_server_config, set_local_socket): Do not use sprintf when its
result might not fit in 'int'.
(set_local_socket): Do not assume uid fits in 'int'.
lib-src/ChangeLog
lib-src/emacsclient.c